package hanqi.mangement.Service;

import hanqi.mangement.Mapper.studentMapper;
import hanqi.mangement.entity.gradebro;
import hanqi.mangement.entity.student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class studentserviceImpl implements studentservice{

    @Autowired
    private studentMapper studentMapper;
    @Override
    public List<student> listAll() {
       return studentMapper.selectList(null);
    }

    @Override
    public student getById(int studentId) {
        return studentMapper.selectById(studentId);
    }

    @Override
    public List<gradebro> getGrades(int studentId) {
        return studentMapper.findGradesByStudentId(studentId);
    }

    @Override
    public void addStudent(student student) {
        studentMapper.insert(student);
    }
}
